package com.java.cloud.account.dao;

import com.java.cloud.account.entity.Account;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

/**
 * 账户表
 * 
 * @author jl
 * @since 2020-03-13 12:21:12
 */
@Mapper
public interface AccountDao extends BaseMapper<Account> {

	@Update("UPDATE `t_account` SET `residue` = `residue` - #{money} , `used` = `used` + #{money} WHERE `user_id` = #{userId}")
	int decrease(@Param("userId") Long userId,@Param("money") BigDecimal money);
	
}
